using UnityEngine;

[CreateAssetMenu(fileName = "New Heal effect", menuName = "Data/Item effect/Heal effect")]
public class HealEffect : ItemEffect
{
    [Range(0, 1f)]
    [SerializeField] private float healPercent;

    public override void ExecuteEffect(Transform transform, Player player)
    {
        // player stats
        if (player == null)
        {
            return;
        }
        PlayerStats playerStats = player.GetComponent<PlayerStats>();
        // how much to heal
        int healAmount = Mathf.RoundToInt(playerStats.GetMaxHp() * healPercent);
        playerStats.IncreaseHpBy(healAmount);
    }
}
